//
//  WJGroup.m
//  JerryIos
//
//  Created by 王军 on 2018/2/1.
//  Copyright © 2018年 王军. All rights reserved.
//

#import "WJMainGroup.h"
#import "WJMainItem.h"

@implementation WJMainGroup

+(instancetype) groupWithDic:(NSDictionary *)dict {
    return [[WJMainGroup alloc] initWithDic:dict];
}

-(instancetype) initWithDic:(NSDictionary *)dict {
    if (self = [super init]) {
        //注入属性（基本属性）
        [self setValuesForKeysWithDictionary:dict];
        
        //特殊处理 Item 属性
        NSMutableArray *itemArray = [NSMutableArray array];
        for (NSDictionary *itemDict in self.itemArray) {
            [itemArray addObject:[WJMainItem itemWithDict:itemDict]];
        }
        self.itemArray = itemArray;
    }
    
    return self;
}

@end
